package com.yiqi.lottery.feature.documentary.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.yiqi.lottery.entity.bo.HallBo;
import com.yiqi.lottery.entity.bo.LotteryBo;
import com.yiqi.lottery.feature.documentary.contract.DocumentaryContract;
import com.yiqi.lottery.feature.documentary.contract.RankContract;
import com.yiqi.lottery.feature.documentary.dependencies.hall.DaggerDocumentaryModelComponent;
import com.yiqi.lottery.feature.documentary.dependencies.rank.DaggerRankModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.LotteryApi;
import io.reactivex.Observable;

import javax.inject.Inject;
import java.util.List;

public class RankModel implements RankContract.Model {

    @Inject
    LotteryApi api;

    @Inject
    public RankModel() {

        DaggerRankModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<LotteryBo>> getRankList(int type,int page) {
        return api.getRankList(type, page).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
